<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <a href="#a">4444</a>

    <div id="a">登陆</div>

    <form action="" method="get">
        <input type="text" name="username">
        <br>
        <input type="password" name="password">
        <br>
        <button>注册</button>
    </form>

    <script>

        // window 对象 
        //    navigator
        //    history
        //    location
        //       href
        //       protocol
        //       port
        //       hostname  baidu.com
        //       host      baidu.com:80
        //       pathname   路径
        //       search    问号后面的一串
        //       hash      #后面的一串   锚点的值     单页面


        //       href 可以读取也可以赋值   --- 可以用来实现页面跳转


        console.log(location.href);
        console.log(location.host);
        console.log(location.hostname);
        console.log(location.pathname);




        var username = 'yy';

        a.onclick = function () {
            // 在地址栏户名加了个"累赘"    ?username=yy&password=123
            location.href = './07_test.html?username=' + username;
        }

    </script>

</body>

</html>